package com.feixiang.springbootinit.model.entity.wechat;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.util.Date;
import lombok.Data;

/**
 * 基础消息表
 * @TableName QW_MESSAGE
 */
@TableName(value ="QW_MESSAGE")
@Data
public class QwMessage {
    /**
     * 自增主键
     */
    @TableId(type = IdType.AUTO)
    private Long id;

    /**
     * 消息id，消息的唯一标识
     */
    @TableField("MSG_ID")
    private String msgId;

    /**
     * 消息动作
     */
    @TableField("ACTION")
    private String action;

    /**
     * 消息发送方
     */
    @TableField("FROM_ID")
    private String fromId;

    /**
     * 消息接收方列表
     */
    @TableField("TOLIST")
    private String tolist;

    /**
     * 群聊消息的jid
     */
    @TableField("ROOMID")
    private String roomid;

    /**
     * 消息序号
     */
    @TableField("SEQ")
    private Long seq;

    /**
     * 消息类型
     */
    @TableField("MSGTYPE")
    private String msgtype;

    /**
     * 解密后的明文消息内容(文本，图片等基本内容)
     */
    @TableField("CONTENT")
    private String content;

    /**
     * 消息发送的时间
     */
    @TableField("MSGTIME")
    private Date msgtime;

    /**
     * 消息状态(子表是否被处理) 0未处理，1处理成功，2处理失败
     */
    @TableField("STATUS")
    private Integer status;

    /**
     * 创建时间
     */
    @TableField("CREATED_TIME")
    private Date createdTime;

    /**
     * 是否删除，0未删除，1已删除
     */
    @TableField("IS_DELETED")
    private Integer isDeleted;

    /**
     * 创建时间
     */
    @TableField("GMT_CREATED")
    private Date gmtCreated;

    /**
     * 修改时间
     */
    @TableField("GMT_MODIFIED")
    private Date gmtModified;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        QwMessage other = (QwMessage) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getMsgId() == null ? other.getMsgId() == null : this.getMsgId().equals(other.getMsgId()))
            && (this.getAction() == null ? other.getAction() == null : this.getAction().equals(other.getAction()))
            && (this.getFromId() == null ? other.getFromId() == null : this.getFromId().equals(other.getFromId()))
            && (this.getTolist() == null ? other.getTolist() == null : this.getTolist().equals(other.getTolist()))
            && (this.getRoomid() == null ? other.getRoomid() == null : this.getRoomid().equals(other.getRoomid()))
            && (this.getSeq() == null ? other.getSeq() == null : this.getSeq().equals(other.getSeq()))
            && (this.getMsgtype() == null ? other.getMsgtype() == null : this.getMsgtype().equals(other.getMsgtype()))
            && (this.getContent() == null ? other.getContent() == null : this.getContent().equals(other.getContent()))
            && (this.getMsgtime() == null ? other.getMsgtime() == null : this.getMsgtime().equals(other.getMsgtime()))
            && (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
            && (this.getCreatedTime() == null ? other.getCreatedTime() == null : this.getCreatedTime().equals(other.getCreatedTime()))
            && (this.getIsDeleted() == null ? other.getIsDeleted() == null : this.getIsDeleted().equals(other.getIsDeleted()))
            && (this.getGmtCreated() == null ? other.getGmtCreated() == null : this.getGmtCreated().equals(other.getGmtCreated()))
            && (this.getGmtModified() == null ? other.getGmtModified() == null : this.getGmtModified().equals(other.getGmtModified()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getMsgId() == null) ? 0 : getMsgId().hashCode());
        result = prime * result + ((getAction() == null) ? 0 : getAction().hashCode());
        result = prime * result + ((getFromId() == null) ? 0 : getFromId().hashCode());
        result = prime * result + ((getTolist() == null) ? 0 : getTolist().hashCode());
        result = prime * result + ((getRoomid() == null) ? 0 : getRoomid().hashCode());
        result = prime * result + ((getSeq() == null) ? 0 : getSeq().hashCode());
        result = prime * result + ((getMsgtype() == null) ? 0 : getMsgtype().hashCode());
        result = prime * result + ((getContent() == null) ? 0 : getContent().hashCode());
        result = prime * result + ((getMsgtime() == null) ? 0 : getMsgtime().hashCode());
        result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
        result = prime * result + ((getCreatedTime() == null) ? 0 : getCreatedTime().hashCode());
        result = prime * result + ((getIsDeleted() == null) ? 0 : getIsDeleted().hashCode());
        result = prime * result + ((getGmtCreated() == null) ? 0 : getGmtCreated().hashCode());
        result = prime * result + ((getGmtModified() == null) ? 0 : getGmtModified().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", msgId=").append(msgId);
        sb.append(", action=").append(action);
        sb.append(", fromId=").append(fromId);
        sb.append(", tolist=").append(tolist);
        sb.append(", roomid=").append(roomid);
        sb.append(", seq=").append(seq);
        sb.append(", msgtype=").append(msgtype);
        sb.append(", content=").append(content);
        sb.append(", msgtime=").append(msgtime);
        sb.append(", status=").append(status);
        sb.append(", createdTime=").append(createdTime);
        sb.append(", isDeleted=").append(isDeleted);
        sb.append(", gmtCreated=").append(gmtCreated);
        sb.append(", gmtModified=").append(gmtModified);
        sb.append("]");
        return sb.toString();
    }
}